﻿using System.Dynamic;
using Basic.FormRemoteModel.FormView;
using Basic.FormRemoteModel.FormView.Model;
using Basic.FormService.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Basic.FormService.RpcEvent
{
    internal class FormViewEvent : IRpcApiService
    {
        private readonly IFormViewService _Service;
        public FormViewEvent ( IFormViewService service )
        {
            this._Service = service;
        }
        public long AddFormView ( AddFormView data )
        {
            return this._Service.Add(data.Datum);
        }

        public void DeleteFormView ( DeleteFormView obj )
        {
            this._Service.Delete(obj.Id);
        }
        public PagingResult<ExpandoObject> QueryFormView ( QueryFormView obj )
        {
            return this._Service.Query(obj.FormId, obj.ToBasicPage());
        }

        public FormViewDto FindFormView ( FindFormView obj )
        {
            return this._Service.Find(obj.FormId);
        }

        public bool SetFormView ( SetFormView set )
        {
            return this._Service.Set(set.Id, set.Datum);
        }
    }
}
